#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=150001;
int n,m,q;
int a[N];
struct node{
    int d,v;
}p[N];
int hd,tl;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    freopen("clear.in","r",stdin);
    freopen("clear.out","w",stdout);
    cin>>n>>m>>q;
    for(int i=1;i<=n;i++)cin>>a[i];
    while(q--){
        int l,r;
        cin>>l>>r;
        ll ans=a[l];
        p[hd=tl=1]=(node){l,a[l]};
        for(int i=l+1;i<=r;i++){
            int b=a[i-1];
            while(hd<=tl&&p[hd].d<=i-m)b-=p[hd++].v;
            if(b<a[i]){
                ans+=a[i]-b;
                p[++tl]=(node){i,a[i]-b};
            }
            else{
                b=b-a[i];
                while(b){
                    int c=p[hd].v;
                    if(b>=c)b-=c,hd++;
                    else p[hd].v-=b,b=0;
                }
            }
        }
        cout<<ans<<'\n';
    }
    return 0;
}
